<template>
  <div>
    <h1>我是day09组件</h1>
    <button @click="schoolBtn()">调取学校接口</button>
    <!-- -------登录-------- -->
    账号：<input type="text" v-model="logoList.mobile">
    密码：<input type="password" v-model="logoList.password">
    <button @click="logoBtn()">登录</button>
    <button @click="depBtn()">获取部门列表</button>
  </div>
</template>

<script>
import request from '../api/request'
import {getS} from '../api/api'
export default {
    name:"MyDay09",
    data() {
        return {
            logoList:{
                mobile: "13800000002",
                password: "hm#qd@23!"
            }
        }
    },
    methods:{
        // 获取学校
        async schoolBtn(){
            const datas = await request.get("/api2/school");
            console.log(datas);
        },
        // 登录
        async logoBtn(){
            const {data} = await request.post(
                `/api3/api/sys/login`,this.logoList);
            console.log(data);
            console.log(data.data);
            sessionStorage.setItem("token",data.data)
        },
        // 获取部门列表
        async depBtn(){
            // const {data} = await request.get(
            //     `/api3/api/company/department`);
            // console.log(data);
            const dataList = {
                department:"/company/department"
            }
            const {data} = await getS(dataList.department);
            console.log(data);
        }
    }
}
</script>

<style>

</style>